:header
call %working_dir%\header.cmd

REM 6-Unmount.bat
REM Once you are done changing the boot.wim OS file this will unmount the image.

:WAIK
REM Change DIR to Windows AIK
cd "%waik%\x86\Servicing"

:Main Menu
if defined source Echo Source set to %source%
if defined index ECHO Index set to %index%
if exist "%MOUNTPATH%\Windows" (ECHO An image is already mounted at %MOUNTPATH%) ELSE ECHO No Image Mounted
ECHO.
ECHO -------------------------------------
ECHO            Unmount Menu
ECHO -------------------------------------
ECHO.
ECHO 1. Commit Changes - Takes a long time on most laptops
ECHO 2. Discard Changes
ECHO Q. Quit to Main Menu
ECHO.
ECHO.

REM ========== Choice Logic ============
choice /c:12q /n /m "%choice_text%"
if errorlevel 3 goto :end
if errorlevel 2 goto :discard
if errorlevel 1 goto :commit

:commit
ECHO.
ECHO Commiting changes to Image
ECHO Please be patient this may take a while...
DISM.exe /unmount-Wim /MountDir:%wim_dest%\mount /commit
goto :end

:discard
ECHO.
ECHO Discarding changes to Image
ECHO Please be patient this may take a while...
DISM.exe /unmount-Wim /MountDir:%wim_dest%\mount /discard
goto :end

:end
call %working_dir%\end.cmd